#!/usr/bin/env python
#! -*- coding: utf-8 -*-

import sqlalchemy
from sqlalchemy.orm import sessionmaker
from sqlalchemy import Column, Integer, SmallInteger, String, Float, Text, Date
from sqlalchemy.ext.declarative import declarative_base

ModelBase = declarative_base()

class AppMedicine_Test(ModelBase):
    """
    接入方药品编码与标准库药品编码对照
    """

    __tablename__ = 'test_1'

    id = Column('id', Integer, primary_key=True, autoincrement=True)
    app_id = Column('app_id', String(50), index=True)
    med_code = Column('med_code', String(128), index=True) # 药品编码
    medicare_code = Column('medicare_code', String(100))        # 医保编码
    medicare_type = Column('medicare_type', String(100))        # 医保类型
    medicare_remark = Column('medicare_remark', String(200))    # 医保备注
    approval_no = Column('approval_no', String(50))             # 批准文号
    med_name = Column('med_name', String(200))
    product_name = Column('trade_name', String(200))      # 产品名称
    acronymy = Column('acronymy', String(50))                     # 首拼
    spec = Column('spec', String(50))                       # 规格
    general_name = Column('general_name', String(200))      # 通用名称
    manufacturer = Column('manufacturer', String(200))             # 生产厂家
    dosage_form = Column('dosage_form', String(50))            # 剂型
    injection = Column('injection', SmallInteger)            # 是否是针剂
    antibacterial = Column('antibacterial', SmallInteger)      # 是否是抗菌药物
    antitumor = Column('antitumor', SmallInteger)      # 是否是抗肿瘤药物
    class_type = Column('class_type', SmallInteger)
    basic_drug = Column('basic_drug', SmallInteger)
    expensive = Column('expensive', SmallInteger)
    antibac_classify = Column('antibac_classify', String(50))   # 抗菌分类
    antibac_type = Column('antibac_type', SmallInteger)
    cn_west_flag = Column('cn_west_flag', SmallInteger)
    hosp_type = Column('hosp_type', String(50))
    packing_spec = Column('packing_spec', String(50))       # 包装规格
    transforable = Column('transforable', SmallInteger)
    information = Column('information', String(1000))
    packing_spec_unit = Column('packing_spec_unit', String(50))   # 包装规格单位
    oper_status = Column('oper_status', SmallInteger)
    uom = Column('uom', String(50))                         # 度量单位
    packing_uom = Column('packing_uom', String(50))
    packing_min_qty = Column('packing_min_qty', Float)      # 包装最小数量
    total_qty = Column('total_qty', Float)                   # 库存
    is_monitor = Column('is_monitor', SmallInteger, default=1)
    opip = Column('opip', SmallInteger)
    ddd = Column('ddd', String(100))
    drug_tips = Column('drug_tips', String(1000))
    menstruum_flag = Column('menstruum_flag', SmallInteger)             # 溶媒标志
    menstruum_alert_msg = Column('menstruum_alert_msg', String(50))  # 溶媒警告信息
    status = Column('status', String(50))
    diagnose_tips = Column('diagnose_tips', String)
    limit_spec_tips = Column('limit_spec_tips', String)
